<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: magic_flicker.php 6757 2010-03-25 09:01:29Z cnteacher $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$idtype = 'cid';
$query = DB::query('SELECT * FROM '.DB::table('home_comment')." WHERE cid = '$id' AND authorid = '$_G[uid]'");
$value = DB::fetch($query);
if(empty($value)) {
	showmessage('magicuse_bad_object');
} elseif($value['magicflicker']) {
	showmessage('magicuse_object_once_limit');
}

if(submitcheck("usesubmit")) {

	DB::update('home_comment', array('magicflicker'=>1), array('cid'=>$id, 'authorid'=>$_G['uid']));
	magic_use($mid, array('id'=>$id, 'idtype'=>$idtype), true);
	showmessage('magicuse_success', dreferer());
}

?>